package com.woniu.controller.homepage;

import com.woniu.entity.Comment;
import com.woniu.entity.Orders;
import com.woniu.service.homePage.IMyAppService;
import com.woniu.util.ResData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 陈乙嘉
 * @data 2023/3/14 17:15
 */
@RequestMapping("/app")
@RestController
public class MyAppController {

    @Autowired
    private IMyAppService myAppService;

    @RequestMapping("findMyOrders")
    public ResData<?> findMyOrders(@RequestBody Orders orders){

        return myAppService.getMyOrdersAndOrderDetails(orders);

    }

    @RequestMapping("userUpdateOrderStatus")
    public ResData<?> userUpdateOrderStatus(@RequestBody Orders orders){
        return myAppService.userUpdateOrderStatus(orders);
    }

    @RequestMapping("insertComments")
    public ResData<?> insertComments(@RequestBody Comment comment){
        return myAppService.insertComments(comment);
    }


    //根据手机号和状态为3查询配送员id
    @RequestMapping("findDispatcherIdByPhoneAndStatus")
    public ResData<?> findDispatcherIdByPhoneAndStatus(String phone,String orderId){
        return myAppService.findDispatcherIdByPhoneAndStatus(phone,orderId);
    }
}
